//
//  R4Controller.m
//  TheRicher
//
//  Created by 李晓东 on 2018/2/4.
//  Copyright © 2018年 PeanutXu. All rights reserved.
//

#import "R6Controller.h"
#import "R6Cell.h"

#import "CController.h"

@interface R6Controller ()
@property (nonatomic, strong) NSArray *resultArray;

@property (nonatomic, strong) CallWhichMethodBlock callWhichMethodBlock;
@end

@implementation R6Controller

- (void)loadView{
    [super loadView];
    
    [self.tableView setDataSource:self];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"TableCellId"];
    _resultArray = [NSArray arrayWithObjects:@"第一掌", @"第二掌", @"第三掌", @"第四掌", @"第五掌", @"第六掌", @"第七掌", @"第八掌", @"第九掌", @"第十掌", @"第十一掌", @"第十二掌", @"第十三掌", @"第十四掌", @"第十五掌", @"第十六掌", @"第十七掌", nil];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _resultArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableCellId" forIndexPath:indexPath];
    [cell.textLabel setText:_resultArray[indexPath.row]];
    [cell setSelectedBackgroundView:[[UIView alloc]initWithFrame:cell.bounds]];
    [cell.selectedBackgroundView setBackgroundColor:[UIColor redColor]];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    CController *controller = [[CController alloc]init];
    
    switch (indexPath.row) {
        case 0:
        case 1:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method2:resultArray];
            };
            break;
        case 2:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method3:resultArray];
            };
            break;
        case 3:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method4:resultArray];
            };
            break;
        case 4:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method5:resultArray];
            };
            break;
        case 5:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method6:resultArray];
            };
            break;
        case 6:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method7:resultArray];
            };
            break;
        case 7:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method8:resultArray];
            };
            break;
        case 8:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method9:resultArray];
            };
            break;
        case 9:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method10:resultArray];
            };
            break;
        case 10:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method11:resultArray];
            };
            break;
        case 11:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method12:resultArray];
            };
            break;
        case 12:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method13:resultArray];
            };
            break;
        case 13:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method14:resultArray];
            };
            break;
        case 14:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method15:resultArray];
            };
            break;
        case 15:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method16:resultArray];
            };
            break;
        case 16:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method17:resultArray];
            };
            break;
        case 17:
            _callWhichMethodBlock = ^(NSArray *resultArray){
                [[KillNumberTools share] method18:resultArray];
            };
            break;
    }
    [controller setCallWhichMethodBlock:_callWhichMethodBlock];
    [self.navigationController pushViewController:controller animated:YES];
}

@end

